package com.micro.service.dubbo.facede;

import com.google.common.collect.Lists;
import com.micro.service.api.ContextFacade;
import com.micro.service.common.po.CommonResult;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import java.util.List;

@Service(version = "1.0.0", timeout = 10000, interfaceClass = ContextFacade.class)
@Component
@RefreshScope
public class ContextFacadeImpl implements ContextFacade {
    /**
     * 存储在配置中心上面配置项
     */
    @Value("${random.access.key}")
    private String key;

    @Override
    public CommonResult<List<String>> getFixInfo(String name) {
        List<String> data = Lists.newArrayList();
        if (StringUtils.isNotBlank(name)) {
            for (int i = 0; i < 100; i++) {
                data.add(i + ":" + key);
            }
        }
        return CommonResult.success(data);
    }
}
